<template>
  <div class="box" :style="{width: width + 'px'}"></div>
  <button @click="add">增加</button>
</template>

<script setup>
  import {ref} from 'vue'
  let width = ref(100)
  function add() {
    width.value += 100
  }
</script>

<style scoped>
  .box {
    background: red;
    height: 100px;
    transition: width 1s linear;
  }
</style>
